<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>控制后台</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="/static/css/layui.css" />
	<link rel="stylesheet" href="/static/css/common.css" />
</head>

<body class="container">
	<div class="layui-row layui-col-space10 layui-bg-gray" style="margin-top: 10px;">
		<div class="layui-col-xs6 layui-col-md3">
			<div class="layui-card top-panel">
				<div class="layui-card-header">数据库个数</div>
				<div class="layui-card-body">
					<div class="layui-row layui-col-space5">
						<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;font-size:36px"
							id="value1">
							0
						</div>
						<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
							<i class="layui-icon layui-icon-test" style="font-size: 55px; color: #265a3d;"></i>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-col-xs6 layui-col-md3">
			<div class="layui-card top-panel">
				<div class="layui-card-header">用户个数</div>
				<div class="layui-card-body">
					<div class="layui-row layui-col-space5">
						<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;font-size:36px"
							id="value2">
							0
						</div>
						<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
							<i class="layui-icon layui-icon-user" style="font-size: 55px; color: #265a3d;"></i>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-col-xs6 layui-col-md3">
			<div class="layui-card top-panel">
				<div class="layui-card-header">操作次数</div>
				<div class="layui-card-body">
					<div class="layui-row layui-col-space5">
						<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;font-size:36px"
							id="value3">
							0
						</div>
						<div class="layui-col-xs4 layui-col-md4  top-panel-tips">
							<i class="layui-icon layui-icon-date" style="font-size: 55px; color: #265a3d;"></i>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-col-xs6 layui-col-md3">
			<div class="layui-card top-panel">
				<div class="layui-card-header">登录次数</div>
				<div class="layui-card-body">
					<div class="layui-row layui-col-space5">
						<div class="layui-col-xs8 layui-col-md8 top-panel-number" style="color: #28333E;font-size:36px"
							id="value4">
							0
						</div>
						<div class="layui-col-xs4 layui-col-md4 top-panel-tips">
							<i class="layui-icon layui-icon-engine" style="font-size: 55px; color: #265a3d;"></i>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="layui-row layui-col-space10">
		<div class="layui-col-md9">
			<div class="layui-card">
				<div class="layui-card-header">操作日志</div>
				<div class="layui-card-body">
					<table class="layui-hide" id="log-data"></table>
				</div>
			</div>
		</div>
		<div class="layui-col-md3">
			<div class="layui-card">
				<div class="layui-card-header">
					链接
				</div>
				<div class="layui-card-body">
					<a target="_blank" href="http://gdoa.top" class="layui-btn layui-btn-primary  layui-btn-fluid"
						style="margin-top: 8px;height: 50px;line-height: 50px;">官
						网</a>
					<br />
					<a target="_blank" href="https://gitee.com/ruitao_admin/gododb"
						class="layui-btn layui-btn-warming  layui-btn-fluid"
						style="margin-top: 8px;height: 50px;line-height: 50px;">下 载</a>
				</div>
			</div>

		</div>
	</div>
	<script type="text/html" id="log-createTime">
		{{layui.util.toDateString(d.addtime*1000, "yyyy-MM-dd HH:mm:ss")}}
	</script>
	<script src="/static/js/layui.js"></script>
	<script>
		layui.extend({
			api: '{/}/static/js/api' // 开头特定符 {/} 即代表采用单独路径
		}).use(['api'],function () {
			let $ = layui.jquery;
			let table = layui.table;
			let layer = layui.layer;
			let api = layui.api;
			let cols = [
				[
					{
						title: '操作人',
						field: 'username',
						align: 'center',
						minWidth : 100,
						fixed : 'left'
					},
					{
						title: '模块',
						field: 'log',
						align: 'center',
						minWidth : 150,
					},
					{
						title: '请求方式',
						field: 'method',
						align: 'center',
						minWidth : 80
					},
					{
						title: '接口',
						field: 'url',
						align: 'center',
						minWidth : 150,
					},
					{
						title: '浏览器',
						field: 'agent',
						align: 'center',
						minWidth : 250,
					},
					
					{
						title: '操作时间',
						field: 'addtime',
						templet: '#log-createTime',
						align: 'center',
						minWidth : 180,
						fixed : 'right'
					}
				]
			]
			api.get('index/welcome', res => {
				console.log(res)
				$('#value1').html(res.dbNum)
				$('#value2').html(res.userNum)
				$('#value3').html(res.opNum)
				$('#value4').html(res.loginNum)
				table.render({
					elem: '#log-data',
					data : res.oplist,
					cols,
					page: false
				})
			})

		});
	</script>
</body>

</html>